package com.zcx.provider1.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaochangxin
 * @date 2022/3/4 11:49
 */
@RestController
public class TestController {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    @RequestMapping("test1")
    public Object test(){
        return "123456";
    }

    @RequestMapping("msg")
    public Object MqSendMessage(String message){
        rabbitTemplate.convertAndSend("internal_project_zcx_testMQ",message);
        return "发送成功";
    }

}
